<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>地图打印</title>
		<link rel="stylesheet" href="theme/default/style.css">
		<link rel="stylesheet" href="css/print.css">
		<script type="text/javascript" src="../jquery/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="OpenLayers.js"></script>
		<style type="text/css">
			body{
				text-align: center;
			}
			body>div{
				margin: 0 auto;
			}
			#wrapper{
				margin: 0 auto;
				border: 4px solid #ccc;
			}
			div.olMap{
				height: 100%; width: 100%;
				background-color: #CFEEFD;
			}
			#legend ul li {
			 text-align: left;
			}
		</style>
	</head>
	<body>
		<div id="printwrapper"><input id="printbt" name="" value="打印" type="button"></div>
		<div id="wrapper"></div>
		<script type="text/javascript">
			new OpenLayers.Renderer.VML("wrapper");
			var wrapper = document.getElementById("wrapper");
			window.setTimeout(function(){
				wrapper.style.width = opener.printw ? opener.printw : false;
				wrapper.style.height = opener.printh ? opener.printh : false;
				wrapper.innerHTML = opener.printcont;
				$(wrapper).find(".olMapViewport").children().eq(0).css("cursor","default");
				
				var maptool = $("#map_controls");
				if(maptool) {
					maptool.hide();
				}
				var zoom = $(".olControlZoom");
				if(zoom) {
					zoom.hide();
				}
			}, 500);
			
            //屏蔽f5
            document.onkeydown = function(){
                if (event.keyCode == 116) {
                    event.keyCode = 0;
                    event.cancelBubble = true;
                    return false;
                }
            }
			
			document.getElementById("printbt").onclick = function(){
				//document.getElementById("printwrapper").style.hide()
				window.print();
			}
        </script>
	</body>
</html>
